<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
	  xmlns:d="http://schemas.microsoft.com/expression/interactivedesigner/2006"
	  mc:Ignorable="d">
  <ControlTemplate x:Key="AquaGelButtonTemplate" TargetType="{x:Type Button}">
    <ControlTemplate.Resources>
      <Storyboard x:Key="MouseEnter" d:StoryboardName="MouseEnter">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[5].(TranslateTransform.X)" Storyboard.TargetName="shadow">
          <SplineDoubleKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5" KeySpline="0.5,0.5,0.5,0.5" Value="3" KeyTime="00:00:00.2500000"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[5].(TranslateTransform.Y)" Storyboard.TargetName="shadow">
          <SplineDoubleKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5" KeySpline="0.5,0.5,0.5,0.5" Value="3" KeyTime="00:00:00.2500000"/>
        </DoubleAnimationUsingKeyFrames>
      </Storyboard>
      <Storyboard x:Key="MouseLeave" d:StoryboardName="MouseLeave">
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[5].(TranslateTransform.X)" Storyboard.TargetName="shadow">
          <SplineDoubleKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5" KeySpline="0.5,0.5,0.5,0.5" Value="1" KeyTime="00:00:00.2500000"/>
        </DoubleAnimationUsingKeyFrames>
        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[5].(TranslateTransform.Y)" Storyboard.TargetName="shadow">
          <SplineDoubleKeyFrame d:KeyEase="Linear;Linear;0.5;0.5;0.5;0.5" KeySpline="0.5,0.5,0.5,0.5" Value="1" KeyTime="00:00:00.2500000"/>
        </DoubleAnimationUsingKeyFrames>
      </Storyboard>
    </ControlTemplate.Resources>
    <Grid x:Name="Grid" RenderTransformOrigin="0.5,0.5">
      <Grid.ColumnDefinitions>
        <ColumnDefinition/>
      </Grid.ColumnDefinitions>
      <Grid.RowDefinitions>
        <RowDefinition Height="0.5*"/>
        <RowDefinition Height="0.5*"/>
      </Grid.RowDefinitions>
      <Rectangle Opacity="0.3" Fill="#FF000000" RadiusX="10" RadiusY="10" Margin="1,1,1,1" Grid.RowSpan="2" x:Name="shadow" RenderTransformOrigin="0.5,0.5">
        <Rectangle.RenderTransform>
          <TransformGroup>
            <TranslateTransform X="0" Y="0"/>
            <ScaleTransform ScaleX="1" ScaleY="1"/>
            <SkewTransform AngleX="0" AngleY="0"/>
            <RotateTransform Angle="0"/>
            <TranslateTransform X="0" Y="0"/>
            <TranslateTransform X="1" Y="1"/>
          </TransformGroup>
        </Rectangle.RenderTransform>
      </Rectangle>
      <Rectangle Stroke="{TemplateBinding BorderBrush}" Fill="{TemplateBinding Background}" RadiusX="10" RadiusY="10" Margin="1,1,1,1" Grid.RowSpan="2" x:Name="background" RenderTransformOrigin="0.5,0.5"/>
      <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="6,6,6,6" Grid.RowSpan="2" x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" RenderTransformOrigin="0.5,0.5"/>
      <Rectangle RadiusX="5" RadiusY="5" Margin="5,3,5,1" Grid.RowSpan="1" x:Name="highlight" RenderTransformOrigin="0.5,0.5">
        <Rectangle.Fill>
          <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
            <LinearGradientBrush.RelativeTransform>
              <TransformGroup>
                <TranslateTransform X="-0.5" Y="-0.5"/>
                <ScaleTransform ScaleX="1" ScaleY="1"/>
                <SkewTransform AngleX="0" AngleY="0"/>
                <RotateTransform Angle="90"/>
                <TranslateTransform X="0.5" Y="0.5"/>
                <TranslateTransform X="0" Y="0"/>
              </TransformGroup>
            </LinearGradientBrush.RelativeTransform>
            <LinearGradientBrush.GradientStops>
              <GradientStopCollection>
                <GradientStop Color="#FFFFFFFF" Offset="0"/>
                <GradientStop Color="sc#0, 1, 1, 1" Offset="1"/>
              </GradientStopCollection>
            </LinearGradientBrush.GradientStops>
          </LinearGradientBrush>
        </Rectangle.Fill>
      </Rectangle>
    </Grid>
    <ControlTemplate.Triggers>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsEnabled" Value="False"/>
        </MultiTrigger.Conditions>
        <Setter Property="Fill" Value="#FFD3D3D3" TargetName="background"/>
      </MultiTrigger>
      <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="IsPressed" Value="True"/>
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" Value="Collapsed" TargetName="shadow"/>
        <Setter Property="Visibility" Value="Collapsed" TargetName="highlight"/>
      </MultiTrigger>
      <EventTrigger RoutedEvent="Mouse.MouseEnter">
        <BeginStoryboard Storyboard="{StaticResource MouseEnter}" x:Name="MouseEnter_BeginStoryboard"/>
      </EventTrigger>
      <EventTrigger RoutedEvent="Mouse.MouseLeave">
        <BeginStoryboard Storyboard="{StaticResource MouseLeave}" x:Name="MouseLeave_BeginStoryboard"/>
      </EventTrigger>
    </ControlTemplate.Triggers>
  </ControlTemplate>

  <Style x:Key="AquaGelButtonTemplateStyle" TargetType="{x:Type Button}">
    <Setter Property="Template" Value="{StaticResource AquaGelButtonTemplate}" />
  </Style>

  <Style x:Key="RedAquaGelButtonTemplateStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource AquaGelButtonTemplateStyle}">
    <Setter Property="Background">
      <Setter.Value>
        <LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
          <LinearGradientBrush.RelativeTransform>
            <TransformGroup>
              <TranslateTransform X="-0.5" Y="-0.5"/>
              <ScaleTransform ScaleX="1" ScaleY="1"/>
              <SkewTransform AngleX="0" AngleY="0"/>
              <RotateTransform Angle="90"/>
              <TranslateTransform X="0.5" Y="0.5"/>
              <TranslateTransform X="0" Y="0"/>
            </TransformGroup>
          </LinearGradientBrush.RelativeTransform>
          <LinearGradientBrush.GradientStops>
            <GradientStopCollection>
              <GradientStop Color="sc#1, 0.5, 0, 0" Offset="0"/>
              <GradientStop Color="sc#1, 1, 0.5, 0.5" Offset="1"/>
            </GradientStopCollection>
          </LinearGradientBrush.GradientStops>
        </LinearGradientBrush>
      </Setter.Value>
    </Setter>
  </Style>

</ResourceDictionary>